<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
 Overview
</title>
<link rel ="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="Stack.jsc Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="../index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="../overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="../allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>Stack.jsc</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		js.util.Stack class http://jsvm.homolo.com/jsvm2.0/docs/api/
 <BR/><BR/><B>Version: </B>2.01, 10/23/05
 <BR/><BR/><B>Author:</B> Wan Changhua
 <BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="Stack.html">js.util.Stack</a></b></td>
    <td>This is the stack class.</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"># language: JSVM2

<span class="comment">/**
 * <span class="attrib">@fileoverview</span> js.util.Stack class http://jsvm.homolo.com/jsvm2.0/docs/api/
 * <span class="attrib">@file</span>		Stack.jsc
 * <span class="attrib">@author</span>	Wan Changhua
 * <span class="attrib">@version</span>	2.01, 10/23/05
 * <span class="attrib">@since</span>		JSVM2.0
 */</span>

package js.util;

import js.lang.Cloneable;
import js.util.ArrayList;

<span class="comment">/**
 * Creates an empty Stack.
 * Inherit from Cloneable
 * <span class="attrib">@author</span>	Wan Changhua
 * <span class="attrib">@version</span>	2.01, 10/23/05
 * <span class="attrib">@extends</span> Cloneable
 * <span class="attrib">@class</span> This is the stack class.
 * <span class="attrib">@constructor</span>
 */</span><span class="reserved">function</span> Stack ()
{
	<span class="comment">/**
	 * <span class="attrib">@private</span>
	 */</span>
	<span class="reserved">this</span>.list = new js.util.ArrayList();
}

<span class="comment">/**
 * Tests if this stack is empty.
 * <span class="attrib">@return</span>  &lt;code&gt;true&lt;/code&gt; if and only if this stack contains 
 *          no items; &lt;code&gt;false&lt;/code&gt; otherwise.
 * <span class="attrib">@type</span> boolean
 */</span>
Stack.<span class="reserved">prototype</span>.empty = <span class="reserved">function</span>()
{
	<span class="reserved">return</span> (<span class="reserved">this</span>.list.size() == 0);
}

<span class="comment">/**
 * Looks at the object at the top of this stack without removing it 
 * from the stack. 
 *
 * <span class="attrib">@return</span>     the object at the top of this stack (the last item 
 *             of the &lt;tt&gt;Vector&lt;/tt&gt; object). 
 * <span class="attrib">@type</span> Object
 */</span>
Stack.<span class="reserved">prototype</span>.peek = <span class="reserved">function</span>()
{
	<span class="reserved">if</span> (<span class="reserved">this</span>.empty())
	{
		<span class="reserved">return</span> null;
	}
	var o = <span class="reserved">this</span>.list.get(0);
	<span class="reserved">return</span> o;
}

 <span class="comment">/**
  * Removes the object at the top of this stack and returns that 
  * object as the value of this function. 
  *
  * <span class="attrib">@return</span>     The object at the top of this stack (the last item 
  *             of the &lt;tt&gt;Vector&lt;/tt&gt; object).
  * <span class="attrib">@exception</span>  EmptyStackException  if this stack is empty.
  * <span class="attrib">@type</span> Object
  */</span>
Stack.<span class="reserved">prototype</span>.pop = <span class="reserved">function</span>()
{
	<span class="reserved">if</span> (<span class="reserved">this</span>.empty())
	{
		<span class="reserved">return</span> null;
	}
	var o = <span class="reserved">this</span>.list.get(0);
	<span class="reserved">this</span>.list.removeAt(0);
	<span class="reserved">return</span> o;

}


<span class="comment">/**
 * Pushes an item onto the top of this stack. This has exactly 
 * the same effect as:
 * &lt;blockquote&gt;&lt;pre&gt;
 * addElement(item)&lt;/pre&gt;&lt;/blockquote&gt;
 *
 * <span class="attrib">@param</span>   item   the item to be pushed onto this stack.
 * <span class="attrib">@return</span>  the &lt;code&gt;item&lt;/code&gt; argument.
 * <span class="attrib">@type</span> boolean
 */</span>
Stack.<span class="reserved">prototype</span>.push = <span class="reserved">function</span>(o)
{
	<span class="reserved">this</span>.list.add(0, o);
}


<span class="comment">/**
 * Returns the 1-based position where an object is on this stack. 
 * If the object &lt;tt&gt;o&lt;/tt&gt; occurs as an item in this stack, this 
 * method returns the distance from the top of the stack of the 
 * occurrence nearest the top of the stack; the topmost item on the 
 * stack is considered to be at distance &lt;tt&gt;1&lt;/tt&gt;. The &lt;tt&gt;equals&lt;/tt&gt; 
 * method is used to compare &lt;tt&gt;o&lt;/tt&gt; to the 
 * items in this stack.
 *
 * <span class="attrib">@param</span>   o   the desired object.
 * <span class="attrib">@return</span>  the 1-based position from the top of the stack where 
 *          the object is located; the return value &lt;code&gt;-1&lt;/code&gt;
 *          indicates that the object is not on the stack.
 * <span class="attrib">@type</span> Object
 */</span>
Stack.<span class="reserved">prototype</span>.search = <span class="reserved">function</span>(o)
{
	<span class="reserved">return</span> <span class="reserved">this</span>.list.indexOf(o);
}

<span class="comment">/**
 * Returns a shallow copy of this &lt;tt&gt;Stack&lt;/tt&gt; instance.  (The
 * elements themselves are not copied.)
 *
 * <span class="attrib">@return</span>  a clone of this &lt;tt&gt;Stack&lt;/tt&gt; instance.
 * <span class="attrib">@type</span> Stack
 */</span>
Stack.<span class="reserved">prototype</span>.clone = <span class="reserved">function</span>()
{
	var o = new Stack();
	o.list = <span class="reserved">this</span>.list.clone();
	<span class="reserved">return</span> o;
}</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="../index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="../overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="../allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Thu Nov 17 20:10:21 2005</div>
</body>
</html>
